<template>
    <div class="box2">
        <h1>{{count}}</h1>
        <p>{{id}}</p>
        <button @click="add(num)">累加</button>
    </div>
</template>

<script>
    export default {
        name : 'Context',
        data(){
            return{
            count:0
            }
        },
        props:{
            num:{
                type:Number,
            },
            id:{
                type : Number,
                default:Date.now()
            },
        },
        methods: {
            add(num){
                this.count += num
            }
        },
    }
</script>

<style lang="css" scoped>
    .box2{
        height: 200px;
        background: yellowgreen;
    }
</style>